package com.webserver.controllers;

import com.webserver.http.HttpRequest;
import com.webserver.http.HttpResponse;
import qrcode.QRCodeUtil;

import java.io.OutputStream;

public class ToolsController {
    public void creatQRCode(HttpRequest request, HttpResponse response){
        String content =request.getParameter("content");

        try {
            OutputStream out =response.getOutputStream();
            QRCodeUtil.encode(content,out);
            response.setContentType("image/jpeg");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
